package cn.tedu.spring.eg1;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author tune_the last
 * @date 2025/11/6 - 14:44
 */

@Component
public class Product {
//    @Value("沙威玛")
    private String title;
    @Value("20")
    private Integer num;
    @Value("有了你生活美好没烦恼")
    private String comment;

    public String getTitle() {
        return title;
    }

    /*
        @Value注解：
        1.依赖注入的注解，支持注入基本类型的数据，比如String、其他的基本类型;
        2.支持属性注入、set方法注入
     */
    @Value("啥啥啥")
    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public String toString() {
        return "Product{" +
                "title='" + title + '\'' +
                ", num=" + num +
                ", comment='" + comment + '\'' +
                '}';
    }
}
